<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <meta name="screen-orientation" content="portrait">
    <title>MultiPicker</title>
    <link rel="stylesheet" type="text/css" href="MultiPicker.css?rev=@@hash"/>
    <style>
        body {
            background: #fefefe;
        }

        h3 {
            position: relative;
            width: 100%;
            height: 50px;
            line-height: 50px;
            text-align: center;
            color: #555;
        }

        h3:after {
            content: '';
            position: absolute;
            width: 100px;
            height: 5px;
            left: 50%;
            bottom: 0;
            margin: 0 -50px;
            background: #ddd;
            border-radius: 10px;
        }

        article {
            color: #333;
            line-height: 1.3;
            padding: 0 30px;
            margin: 20px 0;
        }

        p {
            color: #777;
            font-size: 14px;
            margin: 5px 0 0 0;
        }

        .block {
            background: rgb(241, 241, 241);
            border-left: 8px solid #D6DBDF;
            padding: 10px 12px;
            margin: 0 0 15px 0;
            overflow: auto;
        }

        input {
            display: block;
            width: 200px;
            margin: 5px auto 10px;
            padding: 5px 20px;
            border: 1px solid #cbcbcb;
            border-radius: 8px;
        }
    </style>
</head>

<body>
<h3>MultiPicker.</h3>
<article>
    <p>0.请在移动端下打开~~</p>
    <p>1.点击下面的输入演示样式</p>
    <input id="multiPickerInput" type="text" placeholder="点我~~看固定效果" disabled/>
    <div class="block">
        自定义json<br/><br/>
        可以执行不同的深度等级<br/><br/>
        如果想要效果,点击input<br/><br/>
    </div>
    <p>2.最终选择的json:</p>
    <div class="block" id="showBlock" style="line-height: 1.5;">
        这里会显示最终的结果
    </div>

    <p>3.也许你需要多个初始化:</p>
    <input id="multiPickerInput2" type="text" placeholder="点我~~看固定效果" disabled/>
    <div class="block" id="showBlock2" style="line-height: 1.5;">
        这里会显示最终的结果
    </div>
</article>

<div id="targetContainer"></div>
<div id="targetContainer2"></div>

<script src="city.js"></script>
<script src="MultiPicker.js"></script>
<script>
    //---------------------函数调用开始---------------------
    new MultiPicker({
        input: 'multiPickerInput',//点击触发插件的input框的id
        container: 'targetContainer',//插件插入的容器id
        jsonData: $city,
        success: function (arr) {
            alert('页面会显示最终结果');
            document.getElementById('showBlock').innerHTML = JSON.stringify(arr);
        }//回调
    });
    //---------------------函数调用结束---------------------

    new MultiPicker({
        input: 'multiPickerInput2',//点击触发插件的input框的id
        container: 'targetContainer2',//插件插入的容器id
        jsonData: [{
          value: 'test1',
        }, {
          value: 'test2',
        }],
        success: function (arr) {
            alert('页面会显示最终结果');
            document.getElementById('showBlock2').innerHTML = JSON.stringify(arr);
        }//回调
    });
</script>
</body>
</html>